<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    /* 
    对象的创建方式
     一.构造函数创建
     二.字面量的形式创建
     */
     //一.构造函数创建
     var Student=new Object();
     console.log(Student);
     Student.name="jason";
     Student.age=20;
     Student.like=function(hobby){
       console.log("我叫"+this.name+"年龄"+this.age+"喜欢"+hobby);
     }
     //Student.like("钓鱼");
     console.log(Student.name);//jason
     console.log(Student.color);//undefined

     //二.字面量的形式创建
     var Teacher={
       name:"老王",
       age:40,
       like:function(hobby){
         console.log("我叫"+this.name+"年龄"+this.age+"喜欢"+hobby);
       }
     }
     Teacher.like("教书");
     console.log(Teacher);
  </script>
</head>
<body>
  
</body>
</html>